//
//  EightViewController.swift
//  swiftTS
//
//  Created by 航电 on 2020/4/2.
//  Copyright © 2020 航电. All rights reserved.
//

import UIKit

class EightViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "tabbar使用";
        // Do any additional setup after loading the view.
        self.onCreateUIForNavigation();
        self.onCreateUIForView();
    }
    

    //TODO:UI
    fileprivate func onCreateUIForNavigation() {
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", style: UIBarButtonItem.Style.plain, target: self, action: #selector(onBackAction));
    }
    
    fileprivate func onCreateUIForView() {
        self.view.backgroundColor = .white;
        
        let bt = UIButton(type: .custom);
        bt.frame = CGRect(x: 80, y: 100, width: 80, height: 80);
        bt.setTitle("跳转", for: .normal);
        bt.setTitleColor(.black, for: .normal);
        bt.addTarget(self, action: #selector(onPushVCAction), for: .touchUpInside);
        self.view.addSubview(bt);
    }
    
    //TODO:Actions
    @objc fileprivate func onBackAction() {
        self.navigationController?.dismiss(animated: true, completion: nil);
    }
    
    @objc fileprivate func onPushVCAction() {
        let vc = EightTabbarViewController();
        self.navigationController?.pushViewController(vc, animated: true);
    }

}
